﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000037 RID: 55
	[Serializable]
	public class IKMappingBone : IKMapping
	{
		// Token: 0x06000296 RID: 662 RVA: 0x00003C5E File Offset: 0x00001E5E
		public IKMappingBone()
		{
		}

		// Token: 0x06000297 RID: 663 RVA: 0x00003C7C File Offset: 0x00001E7C
		public IKMappingBone(Transform bone)
		{
			this.bone = bone;
		}

		// Token: 0x06000298 RID: 664 RVA: 0x00003CA1 File Offset: 0x00001EA1
		public override bool IsValid(IKSolver solver, ref string message)
		{
			if (!base.IsValid(solver, ref message))
			{
				return false;
			}
			if (this.bone == null)
			{
				message = "IKMappingBone's bone is null.";
				return false;
			}
			return true;
		}

		// Token: 0x06000299 RID: 665 RVA: 0x00003CCD File Offset: 0x00001ECD
		public void StoreDefaultLocalState()
		{
			this.boneMap.StoreDefaultLocalState();
		}

		// Token: 0x0600029A RID: 666 RVA: 0x00003CDA File Offset: 0x00001EDA
		public void FixTransforms()
		{
			this.boneMap.FixTransform(false);
		}

		// Token: 0x0600029B RID: 667 RVA: 0x00003CE8 File Offset: 0x00001EE8
		public override void Initiate(IKSolverFullBody solver)
		{
			if (this.boneMap == null)
			{
				this.boneMap = new IKMapping.BoneMap();
			}
			this.boneMap.Initiate(this.bone, solver);
		}

		// Token: 0x0600029C RID: 668 RVA: 0x00003D12 File Offset: 0x00001F12
		public void ReadPose()
		{
			this.boneMap.MaintainRotation();
		}

		// Token: 0x0600029D RID: 669 RVA: 0x00003D1F File Offset: 0x00001F1F
		public void WritePose(float solverWeight)
		{
			this.boneMap.RotateToMaintain(solverWeight * this.maintainRotationWeight);
		}

		// Token: 0x040001B5 RID: 437
		public Transform bone;

		// Token: 0x040001B6 RID: 438
		[Range(0f, 1f)]
		public float maintainRotationWeight = 1f;

		// Token: 0x040001B7 RID: 439
		public IKMapping.BoneMap boneMap = new IKMapping.BoneMap();
	}
}
